package com.riddle.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.ibatis.session.SqlSession;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import com.riddle.dao.BaseDao;
import com.riddle.dao.RoleDao;
import com.riddle.model.Permission;
import com.riddle.model.Role;
import com.riddle.vmodel.ValuePair;

@Service
@Scope("prototype")  
public class RoleService extends BaseService<Role> {

	@Resource
	private RoleDao roleDao;
	
	protected  BaseDao getDao() {
		return roleDao;
	}
	
	public Role getRoleWithPermission(Long id){
		return roleDao.getRoleWithPermission(id);
	}
	
	public void deleteRolePermission(Long id) {
		roleDao.deleteRolePermission(id);
	}
	
	public void saveRolePermission(List<ValuePair<Long, String>> list) {
		roleDao.saveRolePermission(list);
	}
	
	public List<Role> getRoleTree(){
		return roleDao.getRoleTree();
	}
}